﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SharepointSolutionInstaller.Utils.Log
{

    public class Logger : ILog
    {

        private static readonly List<string> messages = new List<string>();

        private Logger()
        {
        }

        private static Logger instance;

        public static Logger messageCollector()
        {
            if (instance == null)
            {
                return new Logger();
            }
            else
            {
                return instance;
            }
        }

        public List<string> Messages
        {
            get { return messages; }
        }

        public void Info(object message)
        {
            messages.Add(message.ToString());
        }

        public void Info(object message, Exception t)
        {
            messages.Add(message.ToString());
            messages.Add(t.ToString());
        }

        public void Warn(object message)
        {
            messages.Add(message.ToString());
        }

        public void Warn(object message, Exception t)
        {
            messages.Add(message.ToString());
            messages.Add(t.ToString());
        }

        public void Error(object message)
        {
            messages.Add(message.ToString());
        }

        public void Error(object message, Exception t)
        {
            messages.Add(message.ToString());
            messages.Add(t.ToString());
        }

        public void Fatal(object message)
        {
            messages.Add(message.ToString());
        }

        public void Fatal(object message, Exception t)
        {
            messages.Add(message.ToString());
            messages.Add(t.ToString());
        }
    }

}